﻿Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.HtmlControls
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design.WebControls
Imports System.Text
Imports System.IO
Imports System.Drawing
Imports System.Web
Imports System.Runtime.Serialization
Imports System.Data.SqlClient
Imports System.ComponentModel.Design
Imports System.Drawing.Design



Public Class Relacion
  Inherits ScriptControl

  Dim IdGrillaCabeceraValor As String = String.Empty
  Public Property IdGrillaCabecera() As String
    Get
      Return IdGrillaCabeceraValor
    End Get
    Set(ByVal value As String)
      IdGrillaCabeceraValor = value
    End Set
  End Property

  Dim IdGrillaDetalleValor As String = String.Empty
  Public Property IdGrillaDetalle() As String
    Get
      Return IdGrillaDetalleValor
    End Get
    Set(ByVal value As String)
      IdGrillaDetalleValor = value
    End Set
  End Property

  Dim ColumnaClaveValor As String = String.Empty
  Public Property ColumnaClave() As String
    Get
      Return ColumnaClaveValor
    End Get
    Set(ByVal value As String)
      ColumnaClaveValor = value
    End Set
  End Property

  Dim ColumnaClaveHijoValor As String = String.Empty
  Public Property ColumnaClaveHijo() As String
    Get
      Return ColumnaClaveHijoValor
    End Get
    Set(ByVal value As String)
      ColumnaClaveHijoValor = value
    End Set
  End Property

  Dim RefrescarEnValor As TipoRefrescarEn = TipoRefrescarEn.Eleccion
  Public Property RefrescarEn() As TipoRefrescarEn
    Get
      Return RefrescarEnValor
    End Get
    Set(ByVal value As TipoRefrescarEn)
      RefrescarEnValor = value
    End Set
  End Property

  Enum TipoRefrescarEn
    Seleccion
    Eleccion
    Invocacion
  End Enum

  Protected Overrides Function GetScriptDescriptors() As IEnumerable(Of ScriptDescriptor)
    Dim descriptor As New ScriptControlDescriptor("MoniMisi2.Relacion", Me.ClientID)
    Dim descriptors As New List(Of ScriptDescriptor)
    descriptor.AddProperty("IdGrillaCabecera", Funciones.EncontrarControl(CType(Funciones.EncontrarControl(Me.IdGrillaCabecera, Me), ExtenderControl).TargetControlID, Me).ClientID)
    descriptor.AddProperty("IdGrillaDetalle", Funciones.EncontrarControl(CType(Funciones.EncontrarControl(Me.IdGrillaDetalle, Me), ExtenderControl).TargetControlID, Me).ClientID)
    descriptor.AddProperty("RefrescarEn", Me.RefrescarEn)
    descriptor.AddProperty("ColumnaClave", Me.ColumnaClave)
    descriptor.AddProperty("ColumnaClaveHijo", Me.ColumnaClaveHijo)
    descriptors.Add(descriptor)
    Return descriptors
  End Function

  Protected Overrides Function GetScriptReferences() As IEnumerable(Of ScriptReference)
    Dim scriptRef As New ScriptReference("MoniMisi2.Relacion.js", Funciones.NombreCompletoEnsamblado(Me.GetType, "MoniMisi2.Relacion"))
    scriptRef.NotifyScriptLoaded = False
    Dim scriptRefs As New List(Of ScriptReference)
    scriptRefs.Add(scriptRef)
    Return scriptRefs
  End Function


End Class

